import path from 'path';
import { LogUtil } from "../../utils/logUtil";
import { FunctionUtils } from '../../utils/functionUtils'
export class DiffSdkHelper {
  static diffSdk(oldSdkPath: string, newSdkPath: string): void {
    try {
      const execSync = require('child_process').execSync;
      let packagePath: string = path.join(__dirname, '../../../', 'package');
      const outputPath = FunctionUtils.getBasicDirName()
      let buffer = execSync(
        `cd ${packagePath} && node ./JS_API_OPTIMIZE_PLUGIN.js -N diff --old ${oldSdkPath}/ets --new ${newSdkPath}/ets --format excel --output ${outputPath}`,
        {
          timeout: 120000,
        }
      );     
    } catch (error) {
      LogUtil.e("diffSdk run node:",error)
    }
  }
}
